package util;

import main.MetaGen;

import org.antlr.runtime.ANTLRStringStream;
import org.antlr.runtime.CommonTokenStream;

import antlr.BasicRegexpLexer;
import antlr.BasicRegexpParser;

public final class ParseRegexp {

    public static MetaGen parse(GenContext ctx, String regexp) throws Exception {
        ANTLRStringStream stream = new ANTLRStringStream(regexp);
        BasicRegexpLexer lexer = new BasicRegexpLexer(stream);
        CommonTokenStream tokens = new CommonTokenStream(lexer);
        BasicRegexpParser parser = new BasicRegexpParser(tokens);
        MetaGen meta = parser.parse(ctx);
        return meta;
    }

    private ParseRegexp() {
        
    }
}
